<%-- 
    Document   : main
    Created on : 24-jun-2014, 3:15:40
    Author     : Ewoud
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <title>Client</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
        <h1>Clients/Consumers</h1>
        
        <h2>SOAP</h2>
        
        <table border="1" >
            <thead>
                <tr>
                    <th><h3>Create bread</h3></th>
                    <th><h3>Create pie</h3></th>
                </tr>
            </thead>
            <tbody>
            <tr><td style="padding: 8px;">
                <form action="create.jsp" method="post">
                    Name: <input type="text" name="name"/><br/>
                    Price: <input type="number" step="0.01" min="0" name="price" value="1"/><br/>
                    Description: <input type="text" name="description"/><br/>
                    <input type="hidden" name="type" value="BREAD">
                    <input type="submit" value="Submit">
                </form>
            </td><td style="padding: 8px;">
                <form action="create.jsp" method="post">
                    Name: <input type="text" name="name"/><br/>
                    Price: <input type="number" step="0.01" min="0" name="price" value="1"/><br/>
                    Description: <input type="text" name="description"/><br/>
                    <input type="hidden" name="type" value="PIE">
                    <input type="submit" value="Submit">
                </form>
            </td></tr>
        </tbody></table>
        
        
        <h3>Items</h3>
        <table border="1" ><tbody><tr><td style="padding: 8px;">
            <%-- start web service invocation --%>
            <pre><%
            try {
                webservice.ItemWebService_Service service = new webservice.ItemWebService_Service();
                webservice.ItemWebService port = service.getItemWebServicePort();
                // TODO process result here
                java.lang.String result = port.getItems();
                out.println(result);
            } catch (Exception ex) {
                out.println("Couldn't get items via SOAP");
                // TODO handle custom exceptions here
            }
            %></pre>
            <%-- end web service invocation --%>
        </td></tr></tbody></table>

        <hr />
        
        <h2>RESTful</h2>
        <h3>Delete item</h3>
        <form action="http://localhost:8080/Client-war/DeleteItemServlet" method="POST">
            <label>Delete item with id: <input type="number" step="1" min="1" name="id" />
            <input type="submit" value="Submit" />
        </form>
        <hr />
            
        <h2>Another web service, somewhere...</h2>
        <h3>Flowers Foods, Inc. (NYSE:FLO)</h3>
        <p><a href="http://localhost:8080/Client-war/FlowersfoodsServlet">More info</a></p>
        <img src="https://www.google.com/finance/getchart?q=FLO"/>

     </body>
</html>
